package com.alawn.security.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.alawn.framework.core.persistence.mybatis.annotation.MyBatisDao;
import com.alawn.framework.services.security.Role;
import com.alawn.framework.services.security.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 * 账号表 Mapper 接口
 * </p>
 *
 * @author johnny
 * @since 2019-02-27
 */
@MyBatisDao
public interface UserMapper extends BaseMapper<User> {

	@Select("select role.* from mz_a_user user left join mz_a_user_role ur on user.id = ur.user_id left join mz_a_role role on ur.role_id = role.id where user.username = '${username}'")
	public List<Role> userHasRole(@Param("username") String username);

}
